package service

import (
	"github.com/astaxie/beego/logs"
)

type Logs_Tool struct{}

func init() {
	// 显示文件名和行号
	logs.EnableFuncCallDepth(true)

	// 异步输出
	logs.Async()

	// 异步输出允许设置缓冲 chan 的大小
	logs.Async(1e3)
}

// 保存redis记录
func (r *Logs_Tool) RedisFile() {
	logs.SetLogger(logs.AdapterMultiFile, `{"filename":"logs/redis/redis.log","separate":["error", "warning", "notice"]}`)
}

// 保存mysql记录
func (r *Logs_Tool) MysqlFile() {
	logs.SetLogger(logs.AdapterMultiFile, `{"filename":"logs/mysql/mysql.log","separate":["error", "warning", "notice"]}`)
}
